package queue_model;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class GeraIntervalo {
	public static final int MAX = 12;	// Numero maximo de intervalos a serem gerados

	public static void gera(String fileName, double min, double max) throws IOException {
		double interval = (max - min) / MAX;
		
		DecimalFormat aproximador = new DecimalFormat( " 0.00 " );
		DecimalFormatSymbols dfs = new DecimalFormatSymbols();
		dfs.setDecimalSeparator('.');
		aproximador.setDecimalFormatSymbols(dfs);
		
		FileWriter writer = new FileWriter(fileName);
		PrintWriter outputFile = new PrintWriter(new BufferedWriter(writer));
		
//		outputFile.println("# min:" + min + " max:" + max + " interval:" + interval + " Qntd:" + MAX);
		System.out.println("# min:" + min + " max:" + max + " interval:" + interval + " Qntd:" + MAX);
		for(int i = 0; i < MAX; i++) {
			outputFile.println(aproximador.format(min + (i * interval)));
//			outputFile.println(min + (i * interval));
		}
		
		outputFile.close();
		writer.close();
	}
	
	public static void main(String[] args) throws IOException {
		gera("FifoA.conf", 1.0, 40.0);
//		gera("FifoB.conf", 2.0, 200.0);
//		gera("SDFA.conf", 14.0, 21.0);
//		gera("SDFB.conf", 16.0, 39.0);
	}

}
